home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / CONVERTR / PARSEHTM / README.TXT < prev    next >
Encoding:
Text File  |  1995-09-18  |  2.6 KB  |  67 lines

  1. Cheap HTML parser
  2. Jim Davis
  3. davis@dri.cornell.edu
  4. July 1994
  5.  
  6. This is code for doing simple processing on HTML. I know there are bugs and
  7. limitations in the code, but it suffices for simple purposes. Among the
  8. limitations: This is an HTML parser, not an SGML parser - it does not
  9. accept a DTD, rather the model of HTML is built into the code. Also it does
  10. not validate the HTML - it will attempt to parse invalid documents, and the
  11. results are undefined if the document is in error.
  12.  
  13. The source code is available as a compressed Unix tar file. It runs under
  14. perl 4.0 patch level 36. I don't know about other versions of perl. This
  15. directory contains:
  16.  
  17. parse-html.pl
  18.      A simple HTML parser written in perl. As it parses the HTML, it calls
  19.      routines (which you may redefine) for each tag encountered, and for
  20.      whitespace and content. You can redefine these routines so as to
  21.      process the HTML document.
  22. html-to-ascii.pl
  23.      Uses the HTML parser to generate a plain ASCII version of an HTML
  24.      document.
  25. html-ascii.pl
  26.      The actual routines to generate the ASCII.
  27. tformat.pl
  28.      A lowlevel text formatter used for generating ASCII. More or less like
  29.      a subset of nroff
  30. html-to-rfc.pl
  31.      Uses the HTML parser to generate a plain ASCII version of an HTML,
  32.      with special formatting requirements for Internet drafts and RFCs
  33. rfc.pl
  34.      Additional routines required for RFC formatting (e.g. page headers and
  35.      footers)
  36.  
  37. Generating RFCs from HTML
  38.  
  39. The RFC format requires there be a header and footer containing, among
  40. other things, the name of the authors, a short title, and so on. You
  41. specify values for these fields with META tags as shown by the following
  42. example.
  43.  
  44. <META name="status" content="Internet Draft">
  45. <META name="title" content="Internet audio protocol">
  46. <META name="date" content="July 1983">
  47. <META name="author" content="Nixon, Haldeman">
  48.  
  49. (The META tag is not officially part of HTML, it was proposed by Roy
  50. Fielding.) The tags should be in the HEAD.
  51.  
  52. Known bugs
  53.  
  54.    * It can't parse the prolog (or whatever you call it) because it does
  55.      not know how to ensure that the square brackets match, e.g. the
  56.      following
  57.  
  58.         <!DOCTYPE HTML [
  59.           <!entity % HTML.Minimal "INCLUDE"<
  60.           <!-- Include standard HTML DTD --<
  61.           <!ENTITY % html PUBLIC "-//connolly hal.com//DTD WWW HTML 1.8//EN"<
  62.           %html;
  63.           ]<
  64.  
  65.    * font tags (e.g. CODE, EM) cause an extra whitespace in output e.g.
  66.      <TT>foo</TT> yields "foo ,".
  67.